<?php

namespace App\Models\Asset;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class Poster
 * @package App\Models\Asset
 * @version August 31, 2018, 10:53 pm CST
 *
 * @property \App\Models\Asset\Sp sp
 * @property string domain
 * @property integer spId
 * @property string dataType
 * @property string metaType
 * @property string metaId
 * @property string posterId
 * @property string thumbnail
 * @property string tags
 * @property string title
 * @property string subtitle
 * @property string short_desc
 * @property string detail
 * @property string working
 * @property string status
 * @property dateTime expire_at
 * @property integer listorder
 */
class Poster extends Model
{
    use SoftDeletes;


    public $table = 'posters';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'domain',
        'spId',
        'dataType',
        'metaType',
        'metaId',
        'posterId',
        'thumbnail',
        'tags',
        'title',
        'subtitle',
        'short_desc',
        'detail',
        'working',
        'status',
        'expire_at',
        'listorder'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'domain' => 'string',
        'spId' => 'integer',
        'dataType' => 'string',
        'metaType' => 'string',
        'metaId' => 'string',
        'posterId' => 'string',
        'thumbnail' => 'string',
        'tags' => 'string',
        'title' => 'string',
        'subtitle' => 'string',
        'short_desc' => 'string',
        'detail' => 'string',
        'working' => 'string',
        'status' => 'string',
        'expire_at' => 'datetime',
        'listorder' => 'integer'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function sp()
    {
        return $this->hasOne(\App\Models\Common\EntityData\Channel\Sp::class, 'id', 'spId');
    }


        /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function posterHrefs()
    {
        return $this->hasMany(\App\Models\Asset\posterHref::class, 'posterId', 'posterId');
    }
}
